package com.pifuke.patient;

import java.util.ArrayList;

import android.app.Application;
import android.content.Intent;

import com.evan.common.connection.ConnectionCommon;
import com.evan.common.share.ShareQQUtils;
import com.evan.common.share.ShareWXUtils;
import com.evan.common.share.ShareWeiboUtils;
import com.evan.common.utils.ImageUtils;
import com.smiier.skin.constant.Constant;
import com.smiier.skin.net.SymptomPatientTask.SymptomPatientItem;
import com.smiier.skin.util.GlobalSettings;
import com.smiier.skin.utils.DBUtil;
import com.smiier.skin.utils.FilesUtil;
import com.umeng.analytics.MobclickAgent;

public class SkinApp extends Application {

	protected static SkinApp application;
	public static ArrayList<SymptomPatientItem> Symptoms = new ArrayList<SymptomPatientItem>();

	@Override
	public void onCreate() {
		super.onCreate();

		GlobalSettings.sApp4Doctor = false;

		application = this;
		FilesUtil.createDir();
		ConnectionCommon.getInstance()
				.setRequestPath(GlobalSettings.SERVER_URL);
		ConnectionCommon.getInstance().setRequestPicPath(
				GlobalSettings.SERVER_IMG_URL);
		// ConnectionCommon.getInstance().setRequestPath(
		// "http://www.xn--ekrq20ff8a10ftsl.net/");
		// ConnectionCommon.getInstance().setRequestPicPath(
		// "http://www.xn--ekrq20ff8a10ftsl.net/mfpic/");
		ShareWXUtils.setWXAPPID(GlobalSettings.WEIXIN_APP_ID_PATIENT);
		ShareWXUtils.setWXAPPSECRET(GlobalSettings.WEIXIN_APP_SECRET_PATIENT);
		ShareQQUtils.setQQAPPID(GlobalSettings.QQ_APP_ID_PATIENT);
		ShareWeiboUtils.setWeiboAPPID(GlobalSettings.WEIBO_APP_KEY_PATIENT);
		// Thread.setDefaultUncaughtExceptionHandler(new
		// GlobalUncaughtExceptionHandler(
		// this));
		ImageUtils.yasuo = 720 * 1280;
		// CrashHandler crashHandler = CrashHandler.getInstance();
		// crashHandler.init(getApplicationContext());
		
		
		Intent refreshIntent = new Intent(
				Constant.RECIVER_SESSION_TAB_NOREAD);
		sendBroadcast(refreshIntent);
		
		
		Intent noInfo = new Intent();
		
		Intent noItem = new Intent();
		
		noInfo.setAction(Constant.RECIVER_MYIFNO_TAB_NOREAD);
		noInfo.putExtra("show", true);
		
		noItem.setAction(Constant.RECIVER_MYIFNO_ITEM_NOREAD);
		
		sendBroadcast(noInfo);
		sendBroadcast(noItem);
	}

	@Override
	public void onTerminate() {
		DBUtil.getInstance(this).release();
		super.onTerminate();
	}

	public SkinApp getInstance() {
		return application;
	}
	
	

}
